/**
 * 
 */
package vikings.encrypter;

/**
 * @author Administrator
 *
 */


import java.security.MessageDigest;

public class Encrypt {

   private String password = null;

   public String getPassword() {
      return password;
   }
   public Encrypt(){}

   public void test()
   {
	   
   }
   public void setPassword(String passwd) {
      try {
    	  	MessageDigest sha = MessageDigest.getInstance("MD5");
    	  	byte[] tmp = passwd.getBytes();
    	  	sha.update(tmp);
    	  	password = new String(sha.digest());
         
      }
      catch (java.security.NoSuchAlgorithmException e) {
         System.out.println("Rats, MD5 doesn't exist");
         System.out.println(e.toString());
      }
   }
/*   public static void main( String [] args ) 
   {
      Encrypt e = new Encrypt();
      String pwd = "password";
      e.setPassword( pwd) ;
      System.out.println("Password: " + pwd + " ------ " + e.getPassword());
         
   }*/

}
